<?php

namespace App\Admin\Actions\Grid;

use Dcat\Admin\Grid\RowAction;
use Dcat\Admin\Widgets\Modal;

class ExamineCourseComment extends RowAction
{
    protected $title = '审核';

    protected $model;

    public function __construct(string $model = null)
    {
        $this->model = $model;
    }

    public function render()
    {
        $form = \App\Admin\Forms\CourseComment::make()->payload([
            'id'      => $this->getKey(),
            'content' => $this->row->content,
            'model'   => $this->model,
        ]);

        return Modal::make()
            ->lg()
            ->title($this->title)
            ->body($form)
            ->button($this->title);
    }
}
